<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.27.2/axios.js"></script>
<body>
    <h1>页面</h1>
    <p>
        账号 : <input id="user" type="text">
    </p>
    <p>
        密码 : <input id="pwd" type="text">
    </p>
    <p>
        <button id="btn">登录</button>
    </p>
</body>

<script>
    const user = document.getElementById('user')
    const pwd = document.getElementById('pwd')
    const btn = document.getElementById('btn')

    btn.addEventListener('click' , () => {
        axios.post("/login" , {
            userName : user.value,
            passWord : pwd.value
        }).then( res =>{
            console.log(res)
        })
    })
</script>
</html>